<!DOCTYPE html>
<html>
<head>
    <title>Contains Example</title>
</head>
<body>

    <input type="button" value="Does html contain body?" onclick="getContains()">

    <script type="text/javascript">
        function getContains(){
            alert(document.documentElement.contains(document.body)); //true
            
        }

    </script>
</body>
</html>